﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Practices.Unity;
using Skynet.WebAdministracion.Views.ExamActivation;

namespace Skynet.WebSite.Administration
{
    public partial class ExamActivationView : Infrastructure.Web.Views.Page, IExamActivationView
    {
        private ExamActivationPresenter _Presenter;
        [Dependency]
        public ExamActivationPresenter Presenter
        {
            get { return _Presenter; }
            set
            {
                _Presenter = value;
                this._Presenter.View = this;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
                this.Presenter.OnViewInitialized();
            this.Presenter.OnViewLoaded();
        }
        protected void lbSave_Click(object sender, EventArgs e)
        {
            this.Presenter.ActivateExam(Guid.Parse(this.ddlCustomer.SelectedValue), Guid.Parse(this.ddlExams.SelectedValue), short.Parse(this.txtDuration.Text), DateTime.Parse(this.txtValidFrom.Text), DateTime.Parse(this.txtValidTo.Text));
        }
        public List<BusinessEntities.Exam> Exams
        {
            set {
                this.ddlExams.DataSource = value;
                this.ddlExams.DataBind();
            }
        }
        public List<BusinessEntities.Customer> Customers
        {
            set {
                this.ddlCustomer.DataSource = value;
                this.ddlCustomer.DataBind();
            }
        }
    }
}